package com.wen.moudle.Managers;

import cn.hutool.core.lang.TypeReference;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import com.wen.entry.Result;
import com.wen.moudle.Account;
import com.wen.moudle.abstractManager;


public class FightManager extends abstractManager {

    public FightManager(Account account) {
        super(account);
    }



    // 关卡
    public Result<String> fightBoss(Integer id){
        HttpResponse response = HttpRequest.post(config.get("关卡")  + id)
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }

    // 天梯
    public Result<String> ladder(){
        HttpResponse response = HttpRequest.post(config.get("天梯"))
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }


    // 打经验宝宝
    public Result<String> fightBaby(){
        HttpResponse response = HttpRequest.post(config.get("经验宝宝"))
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }





    // 领取奖杯
    public Result<String> getTrophy(){
        HttpResponse response = HttpRequest.post(config.get("领取奖杯"))
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }

    // 碎片场
    public Result<String> DebrisArena(){
        HttpResponse response = HttpRequest.post(config.get("碎片竞技场"))
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }

    // npc碎片场
    public Result<String> npcDebrisArena(){
        HttpResponse response = HttpRequest.post(config.get("npc碎片竞技场"))
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }

    // npc经验场
    public Result<String> npcExperienceArena(){
        HttpResponse response = HttpRequest.post(config.get("npc经验竞技场"))
                .cookie(getCookies())
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }

    // 经验场
    public Result<String> experienceArena(){
        HttpResponse response = HttpRequest.post(config.get("经验竞技场"))
                .cookie(getCookies())
                .contentType("application/json")
                .execute();
        return JSONUtil.toBean(response.body(), new TypeReference<Result<String>>() {},false);
    }
}
